<nz-card class="m-b-2">
  <!-- seach START -->
  <div class="zdy-seach-wrap">
    <div nz-space class="seach-content">
      <div *nzSpaceItem class="seach-item">
        <label class="seach-label">状态</label>
        <div class="seach-control">
          <nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择" [(ngModel)]="seachParams.state">
            <nz-option nzLabel="待审核" [nzValue]="0"></nz-option>
            <nz-option nzLabel="审核不通过" [nzValue]="2"></nz-option>
            <nz-option nzLabel="待打款" [nzValue]="3"></nz-option>
            <nz-option nzLabel="已打款" [nzValue]="1"></nz-option>
          </nz-select>
        </div>
      </div>

      <div *nzSpaceItem class="seach-item">
        <label class="seach-label">申请时间</label>
        <div class="seach-control">
          <nz-range-picker
            [(ngModel)]="dateArrs"
            (ngModelChange)="timeChange($event)">
          </nz-range-picker>
        </div>
      </div>

      <div *nzSpaceItem class="seach-item">
        <button nz-button nzType="primary" class="m-r-8" (click)="seachData()">查询</button>
        <button nz-button nzType="default" (click)="resetData()">重置</button>
      </div>
    </div>
  </div>
  <!-- seach END -->
</nz-card>

<nz-card>
  <!-- Table START -->
  <div class="pagination-wrap-position">
    <div class="table-wrap">
      <nz-table
        #basicTable
        nzSize="small"
        nzShowSizeChanger
        nzShowQuickJumper
        nzOuterBordered
        [nzFrontPagination]="false"
        [nzLoadingDelay]="100"
        [nzLoading]="tableParams.tableLoading"
        [nzData]="tableData"
        [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
        [nzTotal]="tableParams.total"
        [nzPageIndex]="tableParams.page"
        [nzPageSize]="tableParams.pageSize"
        [nzShowTotal]="totalTemplate"
        (nzPageIndexChange)="onPageIndexChange($event)"
        (nzPageSizeChange)="onPageSizeChange($event)"
      >
        <thead>
          <tr>
            <th nzAlign="center">申请日期</th>
            <th nzAlign="center">提现金额</th>
            <th nzAlign="center">流水记录</th>
            <th nzAlign="center">银行账户</th>
            <th nzAlign="center">状态</th>
            <th nzAlign="center">操作</th>
          </tr>
        </thead>

        <tbody>
          <tr *ngFor="let data of basicTable.data; let index = index;">
            <td nzAlign="center">{{ data.createTime || '-' }}</td>
            <td nzAlign="center">{{ data.amount | number: '1.2' }}</td>
            <!-- 流水记录 -->
            <td nzAlign="center">
              <button nz-button nzType="link" [disabled]="!data.count" (click)="openRecord(data)">{{ data.count || '-' }}</button>
            </td>
            <td nzAlign="center">账户名称：{{ data.bankName || '-' }}</td>
            <td nzAlign="center">
              <span [ngStyle]="{'color': data.auditStatus | drawbackState: 'color'}">
                {{ data.auditStatus | drawbackState: 'text' }}
              </span>
            </td>
            <td nzAlign="center">
              <button nz-button nzType="link" (click)="jumpPage(data)">查看</button>
              <button nz-button nzType="link" (click)="downFile(data)">下载</button>
              <button nz-button nzType="link" (click)="copyInfo(data)">复制</button>
              <button nz-button nzType="link" *ngIf="data.auditStatus == 0 || data.auditStatus == 2; else templateOpera" [disabled]="data.auditStatus == 2" (click)="openModal(0, data)">审核</button>
              <ng-template #templateOpera>
                <button nz-button nzType="link" [disabled]="data.auditStatus == 1" (click)="openModal(1, data)">打款</button>
              </ng-template>
            </td>
          </tr>
        </tbody>
      </nz-table>

      <!-- 分页template -->
      <ng-template #totalTemplate let-total>共有 {{ tableParams.total }} 条</ng-template>
    </div>
  </div>
  <!-- Table END -->
</nz-card>

<!-- 审核Modal STRAT -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="isAdoptPaymentVisible"
  [nzTitle]="modalTitle"
  (nzOnCancel)="handleCancel()">

  <div *nzModalContent>
    <div class="custom-model-body">
      <div class="remarks-wrap">
        <span class="label-sp">备注：</span>
        <nz-textarea-count style="width: 100%;" [nzMaxCharacterCount]="100">
          <textarea rows="4" maxlength="100" nz-input [(ngModel)]="auditDesc"></textarea>
        </nz-textarea-count>
      </div>
    </div>

    <div class="custom-model-foot">
      <div class="custom-foot-cont">
        <button nz-button nzType="primary" [nzLoading]="adoptLoading" *ngIf="modalTitle == '审核'" (click)="subAdoptPayment(3)">通过</button>
        <button nz-button nzType="primary" [nzLoading]="adoptNotLoading" *ngIf="modalTitle == '审核'" (click)="subAdoptPayment(2)">不通过</button>
        <button nz-button nzType="primary" [nzLoading]="paymentLoading" *ngIf="modalTitle == '打款'" (click)="subAdoptPayment(1)">已打款</button>
        <button nz-button nzType="default" (click)="handleCancel()">取消</button>
      </div>
    </div>
  </div>
</nz-modal>
<!-- 审核Modal END -->

<!-- 流水记录 START -->
<app-flow-record #flowRecord [changeNo]="operationItem.changeNo"></app-flow-record>
<!-- 流水记录 END -->